<%--
  Created by IntelliJ IDEA.
  User: Shisanyang
  Date: 2020/3/28
  Time: 18:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page import="java.util.Date" %>
<% pageContext.setAttribute("contextPath", request.getContextPath());%>
<html>
<head>
    <title>员工</title>
    <script type="text/javascript" src="${contextPath}/static/js/jquery-3.4.1.js"></script>
</head>
<body>

<%=new Date()%>
<br/>
<a href="${contextPath}/getallajax">ajax获取所有员工</a>
<div>

</div>

<script type="text/javascript">
    $("a:first").click(function(){
        //1、发送ajax获取所有员工上
        $.ajax({
            url:"${contextPath}/getallajax",
            type:"GET",
            success:function(data){
                console.log(data);
                $.each(data,function(){
                    var empInfo = this.lastName+"-->"+this.birth+"--->"+this.gender;
                    $("div").append(empInfo+"<br/>");
                });
            }
        });

        return false;
    });
</script>
</body>
</html>
